package com.gj.baselib.sysutils;

import android.app.Activity;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.view.Menu;
import android.widget.TextView;

import com.gj.baselib.R;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;

public class AppUtilsActivity extends Activity {

	@ViewInject(R.id.txt_appversion)
	private TextView txt_appversion;

	@ViewInject(R.id.txt_appmaxusememory)
	private TextView txt_appmaxusememory;

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_apputils);

		ViewUtils.inject(this);

		StringBuffer sbuffer = new StringBuffer();
		
		try {
			sbuffer.append("应用版本号："
					+ AndroidAppUtils.getAppVersion(this)+"\r\n");
			sbuffer.append("应用最大使用内存大小(KB)："
					+ AndroidAppUtils.getApplicationUseMaxMemory()+"\r\n");
			
		} catch (NameNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		txt_appversion.setText(sbuffer.toString());
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();
	}
}
